package com.mz.mattress.api.config;

import com.aliyun.oss.ClientBuilderConfiguration;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class OssConfig {

    public static final String accessKeyId = "LTAI5tDCoxQvNYmghswcruex";
    public static final String accessKeySecret = "JUimPav7eBmwRa7jFPwScCuIfCYzWF";
    //    public static final String endpoint = "https://oss-cn-hangzhou-internal.aliyuncs.com";
    public static final String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
    //    public static final String endpoint = "https://oss-cn-beijing.aliyuncs.com";
    //    public static final String endpoint = "oss-cn-hangzhou.aliyuncs.com";
    public static final String bucketName = "meizhong-prod";
    public static final String urlPrefix = "https://alf.beautymz.com/";
    public static final String callbackUrl = "https://www.beautymz.com/pc/oss/ali/callback";

    //    @Bean
    public OSS ossClient() {

        ClientBuilderConfiguration conf = new ClientBuilderConfiguration();
        conf.setMaxConnections(30);
        conf.setConnectionTimeout(100000);
        conf.setRequestTimeout(100000);
        conf.setSocketTimeout(100000);

        OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret, conf);

        return ossClient;
    }

}
